import java.awt.*;
import java.net.URL;

import javax.swing.*;

public class MyImageIcon extends JFrame {
    public MyImageIcon() {
        setBounds(100,100,500,350);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        Container c=getContentPane();
        JLabel j=new JLabel("图片标签");
        URL url = MyImageIcon.class.getResource("/pic.png");
        JLabel jl1=new JLabel(new ImageIcon("pic.png"));
        c.add(jl1);
        System.out.print(url);
        c.add(j);
        setVisible(true);
    }
    public static void main(String[]args) {
        new MyImageIcon();
    }
}